﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using System.ComponentModel;
using System;


namespace SalesPortal.Web.Models
{
    public interface IPaginator
    {
        TablePagination TablePager { get; set; }
    }

    public class EmployeeListingViewModel : Employee, IPaginator
    {
        public EmployeeFilter Filter { get; set; }

        [UIHint("EmployeeList")]
        public IEnumerable<Employee> EmployeeList { get; set; }

        public TablePagination TablePager { get; set; }
    }

    [MetadataType(typeof(EmployeeMetaData))]
    public partial class Employee
    {
        class EmployeeMetaData
        {
            [DisplayName("Full Name")]
            public string LegalName { get; set; }

            [DisplayName("Date of Birth")]
            [DisplayFormat(ApplyFormatInEditMode=true, DataFormatString="{0:yyyy-MM-dd}")]
            [DataType(DataType.Date)]
            public System.DateTime DateOfBirth { get; set; }

            [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:C2}")]
            public decimal Salary { get; set; }

            [UIHint("EmployeeStatus")]
            public byte Status { get; set; }

            [DisplayName("First Name")]
            public string FirstName { get; set; }

            [DisplayName("Last Name")]
            public string LastName { get; set; }
        }
    }

    public class EmployeeFilter
    {
        [DisplayName("Full Name")]
        public string LegalName { get; set; }

        [DisplayName("(from)")]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
        [DataType(DataType.Date)]
        public DateTime? StartDateOfBirth { get; set; }

        [DisplayName("(to)")]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
        [DataType(DataType.Date)]
        public DateTime? EndDateOfBirth { get; set; }

        [DisplayName("(from)")]
        public Decimal? StartSalary { get; set; }

        [DisplayName("(to)")]
        public Decimal? EndSalary { get; set; }

        //[UIHint("EmployeeStatus")]
        public byte? Status { get; set; }
    }

}